package com.spa.infrastructure.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.filter.AbstractRequestLoggingFilter;

import javax.servlet.http.HttpServletRequest;

@Slf4j
public class ServletContextRequestLoggingFilter extends AbstractRequestLoggingFilter {
    @Override
    protected void beforeRequest(HttpServletRequest request, String message) {
//        log.info("beforeRequest {}", message);
//        Enumeration<String> enumeration = request.getHeaderNames();
//        while (enumeration.hasMoreElements()) {
//            String header = enumeration.nextElement();
//            log.info("header :{} value :{}", header, request.getHeader(header));
//        }
    }

    @Override
    protected void afterRequest(HttpServletRequest request, String message) {
//        log.info("afterRequest {}", message);
//        Enumeration<String> enumeration = request.getHeaderNames();
//        while (enumeration.hasMoreElements()) {
//            String header = enumeration.nextElement();
//            log.info("header :{} value :{}", header, request.getHeader(header));
//        }
    }
}
